<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body ng-app="myApp">
    自定义标签
    <klren-directive></klren-directive>
    <br> 属性
    <div klren-directive></div>
    <br> 注释
    <!-- directive: klren-directive -->
    <br> 类名
    <div class="klren-directive"></div>
    <script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
    <script>
        var app = angular.module("myApp", []);
        app.directive("klrenDirective", function() {
            return {
                /*
                    restrict值：
                        E 属性名使用
                        A 属性使用
                        C 类名使用
                        M 注释使用
                */
                restrict: "M",
                replace: true,
                template: "<h2>自定义指令！</h2>"
            }
        })
    </script>
</body>

</html>